import { Controller } from '@nestjs/common';
import { ApiTags, ApiResponse, ApiQuery, ApiBody } from '@nestjs/swagger';
import { Crud, CrudController, ParsedRequest, ParsedBody, CrudRequest, Override } from '@nestjsx/crud';
import { Topic } from '../../entities/topic.entity';
import { TopicService } from '../../services/topic/topic.service';

@Crud({
    model:{
        type: Topic
    },
    query: {
        exclude:["topic_category_id","topic_template_id","topic_tag_id","scene_pic_url"]
    }
})
@ApiTags('topic')
@Controller('api/topic')
export class TopicController implements CrudController<Topic>{
    constructor(
        public service:TopicService
    ){}

    get base(): CrudController<Topic> {
        return this;
    }

    @Override()
    createOne(
    @ParsedRequest() req: CrudRequest,
    @ParsedBody() dto: Topic): Promise<Topic> {
        console.log(req,dto);
        return this.base.createOneBase(req, dto);
    }
}
